function UrlSearch(url) {
  let str = urlDelP(window.location.href, 'tab'); // 取得整个地址栏
  if (str.indexOf("?") > -1) {
    let num = str.indexOf("?")
    str = str.substr(num + 1); // 取得所有参数
    return url + '?' + str
  } else {
    return url
  }
}

function urlDelP(url, name) {
  let urlArr = url.split('?');
  if (urlArr.length > 1 && urlArr[1].indexOf(name) > -1) {
    let query = urlArr[1];
    let obj = {};
    let arr = query.split("&");
    for (let i = 0; i < arr.length; i++) {
      arr[i] = arr[i].split("=");
      obj[arr[i][0]] = arr[i][1];
    };
    delete obj[name];
    let urlte = urlArr[0] + '?' + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&");
    return urlte;
  } else {
    return url;
  }
}

const config = {
  mianNav: [
    {
      title: '公寓房态',
      link: UrlSearch('/rent/apartment/status/table'),
      code: 'rent_room_state',
    },
    {
      title: '商铺房态',
      link: UrlSearch('/rent/shops/list'), 
      code: 'rent_shops_state',
    },
    {
      title: '房源管理',
      link: UrlSearch('/room/source/list'), 
      code: 'room_source_status', 
    },
    {
      title: '住户查询',
      link: UrlSearch('/rent/tenants/info'), 
      code: 'my_work_status',
    },
    { 
      title: '我的工作',
      link: UrlSearch('/rent/myWork/index'), 
      code: 'my_work_status', 
    },
    {
      title: '更多', 
      link: UrlSearch('/index/more'),
      code: 'applicationAll',
    },
  ],
  NoticeNav: [
    {
      title: '通知公告',
      link: UrlSearch('/pcInformManage/notice/index'),
      code: 'notice_announcement'
    },
    {
      title: '短信公告',
      link: UrlSearch(`/pcInformManage/notice/SMSAnnouncement`),
      code: 'sms_announcement',
    }
  ],
  
  toConfigure: [
    {
      title: '通知类型管理',
      link: UrlSearch('/pcInformManage/setup/NotificationType'),
      code: 'notification_type'
    },
    {
      title: '短信模板',
      link: UrlSearch(`/pcInformManage/setup/ShortMessage`),
      code: 'short_message',
    },
    {
      title: '通知公告模板',
      link: UrlSearch(`/pcInformManage/setup/Announcement`),
      code: 'announcement',
    },
    {
      title: '传播渠道管理',
      link: UrlSearch(`/pcInformManage/setup/CommunicationChannels`),
      code: 'communication_channels',
    }
  ],
  businessNav: [
    {
      title: '预定管理',
      link: UrlSearch('/index/business/reserve'),
      code: 'business_bookings_manage'
    }
  ],
  clientNav: [
    {
      title: 'App展示',
      link: UrlSearch('/client/app'),
      code: 'app_show'
    },
    {
      title: 'Banner管理',
      link: UrlSearch('/client/banner'),
      code: 'client_configuration_banner_manage'
    },
    {
      title: '通知管理',
      link: UrlSearch('/client/notice'),
      code: 'client_configuration_notice_manage'
    },
    {
      title: '文章管理',
      link: UrlSearch('/client/article'),
      code: 'client_configuration_article_manage'
    },
    {
      title: '广告管理',
      link: UrlSearch('/client/adv'),
      code: 'client_configuration_adv_manage'
    },
    {
      title: '热门话术',
      link: UrlSearch('/client/popular'),
      code: 'client_configuration_popular_manage'
    },
  ],
  communityNav: [
    {
      title: '社团管理',
      link: UrlSearch('/community/group'),
      code: 'community_operating_group'
    },
    {
      title: '活动管理',
      link: UrlSearch('/community/activity'),
      code: 'community_operating_activity'
    }
  ],
  activityListNav: [
    {
      title: '营销活动',
      link: UrlSearch('/marketing/activity'),
      code: 'rt_marketing_activities'
    }
  ],
  couponsListNav: [
    {
      title: '券',
      link: UrlSearch('/marketing/coupons'),
      code: 'marketing_coupons_list'
    }
  ],
  workOrderNav: [
    {
      title: '工单配置',
      link: UrlSearch('/index/workOrder'),
      code: 'order_activities_list'
    },
    // {
    //   title: '表单配置',
    //   link: UrlSearch(`/taskFms/taskFmsForm`),
    //   code: 'orderForm',
    //   type: 'form'
    // }
  ],
  tagNav: [
    {
      title: '标签管理',
      link: UrlSearch('/index/tag/list'),
      code:'tag_manager',
    },
  ],
  priceTemplateNav: [
    {
      title: '定价模型',
      link: UrlSearch('/index/priced/template'),
      code: 'pricing_model'
    }
  ],
  itNav: [
    {
      title: 'IT管理',
      link: UrlSearch('/index/it'),
      code: 'it_manage'
    }
  ],
  contractNav: [
    {
      title: '合同管理',
      link: UrlSearch('/index/contract'),
      code: 'contract_management'
    }
  ],
  billNav: [
    {
      title: '账单管理',
      link: UrlSearch('/index/bill'),
      code: 'bill_orders'
    }
  ],
  marketingActiveNav: [
    {
      title: '预售活动',
      link: UrlSearch('/index/active'),
      code: 'marketing_activities'
    }
  ],

  projectNav: [{
    title: '项目管理',
    link: UrlSearch('/project/list'),
    code: 'project_config_manage'
  }],

  projectManageNav: [{
      title: '项目详情',
      link: UrlSearch('/project/manage/details'),
      code: 'project_config_manage_detail'
    },
    {
      title: '项目空间',
      link: UrlSearch('/project/manage/region'),
      code: 'project_config_manage_area'
    },
    {
      title: '销售规则',
      link: UrlSearch('/project/manage/sale'),
      code: 'sales_rules'
    },
    {
      title: '合同配置',
      link: UrlSearch('/project/manage/contract'),
      code: 'contract_rules'
    },
    {
      title: '入住资产确认项',
      link: UrlSearch('/project/manage/assets'),
      code: 'rent_recognition'
    },
    {
      title: '定损配置',
      link: UrlSearch('/project/manage/lossAssessment'),
      code: 'lossAssessment_rules'
    },
    {
      title: '维修配置',
      link: UrlSearch('/project/manage/repair'),
      code: 'lmaintain_rules'
    },
    {
      title: '角色授权',
      link: UrlSearch('/project/manage/role'),
      code: 'project_config_role'
    },
    {
      title: '支付配置',
      link: UrlSearch('/project/manage/payment'),
      code: 'project_config_payment'
    },
    {
      title: 'app授权',
      link: UrlSearch('/project/manage/appAuthor/menu'),
      code: 'project_app_author_menu'
    }
  ],
  ownerEscrowNav: [
    {
      title: '业主代管业务',
      link: UrlSearch('/owner/escrow'),
      code: 'owner_service_management'
    }
  ],
  leasingNav: [
		{
			title: '合约管理',
      link: UrlSearch('/leasing/contract/list'),
      code:'rent_enterprise_contract_manage'
		},
    {
      title: '企业管理',
      link: UrlSearch('/leasing/enterprise'),
      code:'rent_enterprise_enterprise_manage'
    }
	],
  schedulingNav: [
    {
      title: '排班管理',
      link: UrlSearch('/scheduling'),
      code:'rt_scheduling_management',
    },
    {
      title: '排班设置',
      link: UrlSearch('/scheduling/ButlerSetting'),
      code:'rt_scheduling_setting',
    },
  ],
  approveOrderNav: [
    {
      title: '工单管理',
      link: UrlSearch('/approveOrder'),
      code:'rt_approve_order',
    },
  ],
  shopsNav: [
    {
			title: '商铺租务合约',
      link: UrlSearch('/rent/shopManagement/contract'),
      code: 'rt_shops_contract'
		},
    {
      title: '商户列表',
      link: UrlSearch('/rent/shopManagement/merchant'),
      code: 'rt_shops_merchant'
    },
    {
      title: '商铺房源管理',
      link: UrlSearch('/rent/shopManagement/source'),
      code:'rt_shops_housing_manage',
    },
  ],

};

export default config
